﻿using System;
using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls;
using Silvermoon.Shapes;
using System.Drawing;

namespace Silvermoon.Windows.Styles
{
    public class MetroToggleSwitchStyle : StyleBase
    {
        public override void Apply(Control c)
        {
            ToggleSwitch ts = c as ToggleSwitch;
            if (ts != null)
            {
                Color col = ts.Color;
                ts.Background = Shape.Empty;
                //ts.ContentChrome = new BorderShape { BorderSize = 3, Color = PhoneColors.Text };
                ts.ContentChrome = new InnerOuterBorderShape();
                ts.ButtonShape = new RectBorderFillShape
                {
                    BorderColor = PhoneColors.Background,
                    Color = PhoneColors.Text,
                    BorderSize = 3,
                    Edges = BorderEdge.Left | BorderEdge.Right,
                    Size = new Size(ToggleSwitch.DefaultButtonWidth, 24)
                };
                ts.TextColor = Color.Empty;
                ts.StateManager = ToggleSwitchManagers.MetroToggleSwitchManager;
                ts.OnBackgroundShape = PhoneColors.Accent;
                if (ts.On==null) ts.On = Shape.Empty;
                if (ts.Off == null) ts.Off = Shape.Empty;
                if (!col.IsEmpty) ts.Color = col;
            }
        }
    }
}
